#ifndef MSG_QUEUE_H
#define MSG_QUEUE_H

#define MSQ_SINGLE_MAX_SPEACE 256
#define MSQ_MAX_QUEUE_LEN 128
#define MSQ_QUEUE_MARGIN 0
#define MSQ_MUTEX_OUT_TIME 5 //5ms

//----------------------------------
typedef struct{
	int reason;
	char data[MSQ_SINGLE_MAX_SPEACE];
}STRUCT_MS;

typedef struct{
	STRUCT_MS *queue;
	int size;			/* size of queue */
	int _len;			/* number of tcs now in queue */
	int start, end;		/* indices to next to get, next to put */
	int allFull;		/* flag meaning it's actually full */
}STRUCT_MS_QUEUE;

//API
int msqInit();
int msqPut(STRUCT_MS *msg);
int msqPopBack(STRUCT_MS *msg);
int msqRemove(int n);
int msqLen();
STRUCT_MS *msqItem(int n);
STRUCT_MS *msqLast();


#endif
